package top.jolyoulu.codegenweb.service.bll.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.jolyoulu.codegenweb.entity.po.GenTemplateFile;
import top.jolyoulu.codegenweb.service.bll.ApiFileDataService;
import top.jolyoulu.codegenweb.service.dal.FileDataService;
import top.jolyoulu.codegenweb.service.dal.GenTemplateFileService;

import java.util.List;

/**
 * @Author: JolyouLu
 * @Date: 2023/4/8 15:12
 * @Description
 */
@Slf4j
@Service
public class ApiFileDataServiceImpl implements ApiFileDataService {

    @Autowired
    private GenTemplateFileService genTemplateFileService;

    @Autowired
    private FileDataService fileDataService;

    @Override
    public boolean removeByGroupId(String groupId) {
        List<GenTemplateFile> fileList = genTemplateFileService.selectByGroupId(groupId);
        fileList.forEach(item -> {
            fileDataService.removeById(item.getFileId());
        });
        return true;
    }
}
